# -*- coding: utf-8 -*-

tRegs = {
        "PM710": { 
          "FEI":  {"registre"  : 4105, 
                   "numRegs"   : 1, 
                   "descripcio": "Factor d'escala intensitat", 
                   "regEscala" : "E", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : False},

          "FEV":  {"registre"  : 4106, 
                   "numRegs"   : 1, 
                   "descripcio": "Factor d'escala voltatge", 
                   "regEscala" : "E", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : False},

          "FEP":  {"registre"  : 4107, 
                   "numRegs"   : 1, 
                   "descripcio": "Factor d'escala pontencia", 
                   "regEscala" : "E", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : False},

          "FEE":  {"registre"  : 4108, 
                   "numRegs"   : 1, 
                   "descripcio": "Factor d'escala energia", 
                   "regEscala" : "E", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : False},

          "HMU":  {"registre"  : 4110, 
                   "numRegs"   : 2, 
                   "descripcio": "Hores i minuts d'us", 
                   "regEscala" : "E", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : False},

          "ERR":  {"registre"  : 4112, 
                   "numRegs"   : 1, 
                   "descripcio": "Registre d'errors", 
                   "regEscala" : "MB", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : True},

          "VSO":  {"registre"  : 7001, 
                   "numRegs"   : 1, 
                   "descripcio": "Versió de sistema operatiu", 
                   "regEscala" : "E", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : True},

          "NSN":  {"registre"  : 7002, 
                   "numRegs"   : 2, 
                   "descripcio": "Número de serie del equip", 
                   "regEscala" : "E", 
                   "valEscala" : 0, 
                   "valMax"    : 0, 
                   "compost"   : True},

          "PAT":  {"registre"  : 4006, 
                   "numRegs"   : 1, 
                   "descripcio": u"Potència Activa total", 
                   "regEscala" : "FEP", 
                   "valEscala" : 0, 
                   "valMax"    : 32767, 
                   "compost"   : False},

          "PAP":  {"registre"  : 4007, 
                   "numRegs"   : 1, 
                   "descripcio": u"Potència Aparent total", 
                   "regEscala" : "FEP", 
                   "valEscala" : 0, 
                   "valMax"    : 32767, 
                   "compost"   : False},

          "PRT":  {"registre"  : 4008, 
                   "numRegs"   : 1, 
                   "descripcio": u"Potència Reactiva total", 
                   "regEscala" : "FEP", 
                   "valEscala" : 0, 
                   "valMax"    : 32767, 
                   "compost"   : False},

          "FPT":  {"registre"  : 4009, 
                   "numRegs"   : 1, 
                   "descripcio": u"Factor de potència total", 
                   "regEscala" : "", 
                   "valEscala" : 0.0001, 
                   "valMax"    : 10000, 
                   "compost"   : False},

          "FRE":  {"registre"  : 4013, 
                   "numRegs"   : 1, 
                   "descripcio": u"Freqüència", 
                   "regEscala" : "", 
                   "valEscala" : 0.01, 
                   "valMax"    : 6500, 
                   "compost"   : False},

          "IPF":  {"registre"  : 4020, 
                   "numRegs"   : 4, 
                   "descripcio": u"Intensitat/fase", 
                   "regEscala" : "FEI", 
                   "valEscala" : 0, 
                   "valMax"    : 32767, 
                   "compost"   : False},

          "TPF":  {"registre"  : 4033, 
                   "numRegs"   : 3, 
                   "descripcio": u"Tensió Fase-Neutre", 
                   "regEscala" : "FEV", 
                   "valEscala" : 0, 
                   "valMax"    : 32767, 
                   "compost"   : False},

          "PAF":  {"registre"  : 4036, 
                   "numRegs"   : 3, 
                   "descripcio": "Pot. Activa/fase",
                   "regEscala" : "FEP", 
                   "valEscala" : 0, 
                   "valMax"    : 32767, 
                   "compost"   : False},

          "CEA":  {"registre"  : 4000, 
                   "numRegs"   : 2, 
                   "descripcio": "Kw/h Activa", 
                   "regEscala" : "FEE", 
                   "valEscala" : 0, 
                   "valMax"    : 0xFFFFFFFF, 
                   "compost"   : True},

          "CER":  {"registre"  : 4004, 
                   "numRegs"   : 2, 
                   "descripcio": "Kvar/h Reactiva/Inductiva", 
                   "regEscala" : "FEE", 
                   "valEscala" : 0, 
                   "valMax"    : 0xFFFFFFFF, 
                   "compost"   : True},

          "THDV": {"registre"  : 4049, 
                   "numRegs"   : 3, 
                   "descripcio": u"% Armònics de tensió/fase", 
                   "regEscala" : "", 
                   "valEscala" : 0.1, 
                   "valMax"    : 10000, 
                   "compost"   : False},

          "THDI": {"registre"  : 4045, 
                   "numRegs"   : 4, 
                   "descripcio": u"% Armònics d'intensitat/fase", 
                   "regEscala" : "", 
                   "valEscala" : 0.1, 
                   "valMax"    : 10000, 
                   "compost"   : False},
        },

        "PM500": {
          "PAT": {"registre"  : 790,
                  "numRegs"   : 1,
                  "descripcio": "Pot. Activa total", 
                  "regEscala" : "",
                  "valEscala" : 0.01,
                  "valMax"    : 32767,
                  "compost"   : False},

          "PRT": {"registre"  : 792,
                  "numRegs"   : 1,
                  "descripcio": "Pot. Reactiva total",
                  "regEscala" : "",
                  "valEscala" : 0.01,
                  "valMax"    : 32767,
                  "compost"   : False},

	  "FRE": {"registre"  : 788,
                  "numRegs"   : 1,
                  "descripcio": u"Freqüència",
                  "regEscala" : "",
                  "valEscala" : 0.01,
                  "valMax"    : 6500,
                  "compost"   : False},

	  "IPF": {"registre"  : 838,
                  "numRegs"   : 3,
                  "descripcio": u"Intensitat/fase" ,
                  "regEscala" : "",
                  "valEscala" : 10,
                  "valMax"    : 32767,
                  "compost"   : False},

	  "TPF": {"registre"  : 782,
                  "numRegs"   : 3, 
                  "descripcio": u"Tensio/fase",
                  "regEscala" : "",
                  "valEscala" : 10,
                  "valMax"    : 32767,
                  "compost"   : False},

	  "PAF": {"registre"  : 798, 
                  "numRegs"   : 3, 
                  "descripcio": u"Potència Activa/fase",
                  "regEscala" : "",
                  "valEscala" : 0.01,
                  "valMax"    : 32767,
                  "compost"   : False}
        }  
}

factorEscala = {"65532": 0.0001,
                "65533": 0.001,
                "65534": 0.01,
                "65535": 0.1,
                "0":     1.0,
                "1":     10,
                "2":     100,
                "3":     1000,
                "4":     10000}

